package com.zhongcw.test.spring.boot.send.request.util;

import java.util.Objects;

/**
 * @author ZCW
 * @createTime 2017/12/15
 * @lastUpdateTime 2017/12/15 ZCW
 */
public class Temp {
    String name;
    Test test;

    public Temp(String name) {
        this.name = name;
    }

    public Temp(String name, Test test) {
        this.name = name;
        this.test = test;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            System.out.println("--引用相等--");
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            System.out.println("--对象为空 || 类型不同--");
            return false;
        }

        Temp temp = (Temp) o;
        if (Objects.equals(name, temp.name) && Objects.equals(test, temp.test)) {
            System.out.println("--属性相等--");
            return true;
        }

        System.out.println("--引用,属性都不相等--");
        return false;
    }

    @Override
    public int hashCode() {

        return Objects.hash(name, test);
    }
}
